<html>
<head><meta charset="utf-8"><title>gdb print variable · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/gdb.20print.20variable.html">gdb print variable</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="197029991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/gdb%20print%20variable/near/197029991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/gdb.20print.20variable.html#197029991">(May 10 2020 at 03:31)</a>:</h4>
<p>some local variables are <code>&lt;optimized out&gt;</code> when debuging rustc with gdb, how can I prevent this? <br>
will <code>configure --disable-optimize</code> help?</p>



<a name="197066366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/gdb%20print%20variable/near/197066366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Derek <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/gdb.20print.20variable.html#197066366">(May 10 2020 at 17:09)</a>:</h4>
<p>Did you build rustc by yourself, following instruction in <a href="https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html" title="https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html">https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html</a><br>
Especially you need, cp config.toml.example config.toml and set debug=true</p>



<a name="197086224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/gdb%20print%20variable/near/197086224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/gdb.20print.20variable.html#197086224">(May 10 2020 at 23:48)</a>:</h4>
<p>FWIW, I've never seen <em>anything</em> in rustc that wouldn't be <code>&lt;optimized out&gt;</code> on windows-msvc or windows-gnu, even when built with <code>debuginfo-level = 2</code>.</p>



<a name="197086419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/gdb%20print%20variable/near/197086419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/gdb.20print.20variable.html#197086419">(May 10 2020 at 23:52)</a>:</h4>
<p>I didn't investigate why it happens, debugging seems to work on hello-world like examples.<br>
Perhaps build system is doing something wrong.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>